package com.hurried1y.controller;


import com.hurried1y.exception.SystemException;
import com.hurried1y.model.enums.BizCodeEnum;
import com.hurried1y.service.UserWalletDetailService;
import com.hurried1y.utils.PageUtils;
import com.hurried1y.utils.R;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * (UserWalletDetail)表控制层
 *
 * @author Hurried1y
 * @since 2023-06-19 11:09:30
 */
@RestController
@RequestMapping("/userWalletDetail")
public class UserWalletDetailController{
    @Autowired
    private UserWalletDetailService userWalletDetailService;

    /**
     * 4. 查询用户钱包金额变动明细的接口
     * @param params 查询参数
     * @return R
     */
    @GetMapping("/page")
    public R page(@RequestParam Map<String, Object> params){
        if(params.isEmpty()){
            throw new SystemException(BizCodeEnum.PARAM_ERROR.getCode(), BizCodeEnum.PARAM_ERROR.getMsg());
        }
        PageUtils page = userWalletDetailService.getPage(params);
        return R.ok().put("page", page);
    }
}

